﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for RECTF
/// </summary>
public class RECTF
{
    public float top;
    public float left;
    public float length;
    public float height;
    public float centerX;
    public float centerY;
    public float xRadius;
    public float yRadius;

    public RECTF()
    {
        //
        // TODO: Add constructor logic here
        //
        top       = 0.0f;
        left        = 0.0f;
        length = 0.0f;
        height = 0.0f;
        centerX  = 0.0f;
        centerY   = 0.0f;
        xRadius = 0.0f;
        yRadius = 0.0f;

    }
    public RECTF(float left,float top,float length,float height)
    {
        this.left = left;
        this.top = top;
        this.length = length;
        this.height = height;
        xRadius = length / 2;
        yRadius = height / 2;
        centerX = left + xRadius;
        centerY = top + yRadius;

    }
    /// <summary>
    /// 进行差值运行,运算方式为调用方法的对象减去参数对象
    /// </summary>
    /// <param name="r1"></param>
    /// <returns></returns>
    public RECTF minusRectF(RECTF r1)
    {
        return new RECTF(this.left - r1.left, this.top - r1.top, this.length - r1.length, this.height - r1.height);
    }

    public void CalculateVariable()
    {
        xRadius = length / 2;
        yRadius = height / 2;
        centerX = left + xRadius;
        centerY = top + yRadius;
    }
}